package com.GetIp;

import java.net.URL;
import java.net.URLConnection;

public class Main95 {
    public static void main(String[] args)throws Exception{
        int size;
        URL url=new URL("http://www.baidu.com");
        URLConnection conn=url.openConnection();
        size=conn.getContentLength();
        size=conn.getContentLength();
        if(size<0){
            System.out.println("文件大小为："+size+"字节");
        }else{
            System.out.println("文件大小为："+size+"bytes");
            conn.getInputStream().close();
        }
    }
}
